package com.stan.core.mapper;

import com.stan.core.mapper.factory.MapperFactory;
import com.stan.core.vo.Task;
import org.apache.ibatis.annotations.*;
import java.util.List;


@Mapper
public interface TaskMapper {
    @Insert("insert into t_task (task_id,task_name,task_params,create_time,start_time,finish_time,task_type,task_status) " +
            "values (#{taskId},#{taskName},#{taskParams},#{createTime},#{startTime},#{finishTime},#{taskType},#{taskStatus});")
    void insert(Task task);

    @Select("select task_id as taskId,task_name as taskName,task_params as taskParams,create_time as createTime,start_time " +
            "as startTime,finish_time as finishTime,task_type as taskType,task_status as taskStatus from t_task " +
            "where task_id == #{taskId} limit 1")
    Task queryTaskByTaskId(@Param("taskId") String taskId);

    @Update("update t_task set task_name=#{taskName},task_params=#{taskParams},create_time=#{createTime},start_time=#{startTime}" +
            ",finish_time=#{finishTime},task_type=#{taskType},task_status=#{taskStatus} where task_id=#{taskId}")
    void update(Task task);
}
